package com.pt25.study.example.domain.sharding.service.impl;

import com.pt25.study.example.domain.sharding.ddo.ShardingSdstms;
import com.pt25.study.example.domain.sharding.factory.ShardingFactory;
import com.pt25.study.example.domain.sharding.service.ShardingSdstmsService;
import com.pt25.study.example.repository.sharding.persistence.ShardingSdstmsRepo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class ShardingSdstmsServiceImpl implements ShardingSdstmsService {

    @Resource
    private ShardingFactory shardingFactory;

    @Resource
    private ShardingSdstmsRepo shardingSdstmsRepo;

    @Override
    public ShardingSdstms getShardingSdstms(Long id) {
        return shardingSdstmsRepo.getShardingSdstms(id);
    }

    @Override
    public void addShardingSdstms(ShardingSdstms shardingSdstms) {
        shardingSdstmsRepo.save(shardingFactory.ShardingSdstms2ShardingSdstmsPo(shardingSdstms));
    }
}
